﻿using System;
using System.Data;

namespace ControleRepresentante.Data
{
    static class DataReaderHelper
    {
        public static T? GetNullableValue<T>(this IDataReader dataReader, string fieldName)
            where T : struct
        {
            return dataReader[fieldName] == DBNull.Value ? (T?) null : (T) dataReader[fieldName];
        }
    }
}
